<?php

$post = 0;
if($_GET['PostId'])
{
	$post = $_GET['PostId'];
	$info = $blog->getInfo($post, 'ee_blog_posts');
	if($info['F_ID_USER_INFO']!=$_SESSION['User_F_ID'])
	{
		echo "您无权查看评论";
		exit();
	}
	$title = "<div>文章：{$info['F_POSTS_TITLE']}</div>";
}
$page = 1;
if($_GET['Page']) $page = $_GET['Page'];

$com_list = $blog->GetCommentsList($blogid,$post,$blog->pagesize,$page);
$count = $blog->GetCommentsCount($postid);
$pagecount = ceil($count/$blog->pagesize);
if(!$pagecount) $pagecount = 1;

?></div>
<div id="content">
<div class="admin-form">
<h3>评论</h3>
<table>
	<thead>
		<tr>
			<th>评论用户</th>
			<th>用户邮箱</th>
			<th>用户blog</th>
			<th>IP地址</th>
			<th>评论内容</th>
			<th>评论时间</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
<?php
if($com_list)
{
	foreach($com_list as $value)
	{
?>
		<tr>
			<td><?php echo $value['F_COMMENTS_USER'] ?></td>
			<td><?php echo $value['F_COMMENTS_USER_EMAIL']?></td>
			<td><?php echo $value['F_COMMENTS_USER_BLOG']?></td>
			<td><?php echo $value['F_COMMENTS_USER_IP'] ?></td>
			<td><?php echo $value['F_COMMENTS_CONTENT'] ?></td>
			<td><?php echo date("Y-m-d H:i", $value['F_COMMENTS_DATE']) ?></td>
			<td><a href="index.php?Action=CommentsDel&ComId=<?php echo $value['F_ID'] ?>" onclick="return confirm('真要删除此评论吗？')">删除</a> <a href="../index.php?Action=Post&Post=<?php echo $value['F_ID_POSTS_INFO'] ?>">查看文章</a></td>
		</tr>
<?php
	}
}
?>
	</tbody>
</table>

<div class="pagination"><?php  echo Page($pagecount, $page, $blog->pagesize, $count); ?></div>
</div></div>